
    (function (window) {
        const date = new Date()
        const vm = new Vue({
            el: '.app',
            data: {
                //usrInfo
                usrID: 1,
                greeting: "早上好",
                isEditing: false,
                editTool: '',
                editToolTitle: '编辑个人信息',
                usrInfo: [
                    { key: '姓名', value: '' },
                    { key: '年龄', value: '' },
                    { key: '性别', value: '' },
                    { key: '邮箱', value: '' }
                ],
                //healthreport
                hasSubmitted: false,
                submitBtnText: '提 交',
                date: `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`, // 本来应该将date放在healthReport内，但是我的填表不需要填时间，本来想v-if隐藏，但v-if='index!=3'失败了
                healthReport: [
                    { key: '体温', value: '', unit: "摄氏度" },
                    { key: '脉搏', value: '', unit: '次/分' },
                    { key: '血压', value: '', unit: 'mmHg' }
                ],

            },
            created() {
                console.log(this.usrInfo[0].value)
                axios({
                    method: 'get',
                    url: 'http://localhost:8888/patient',
                }).then(res => {

                    this.usrInfo[0].value = res.data.username
                    this.usrInfo[1].value = res.data.age
                    this.usrInfo[2].value = res.data.gender=='1'?"男":"女"
                    this.usrInfo[3].value = res.data.email
                    ail
                }).catch(err =>{
                    console.log(err)
                })
            },
            methods: {
                changeEditingState() {
                    if (this.isEditing) {
                        this.isEditing = false
                        this.editTool = ''
                        this.editToolTitle = '编辑个人信息'
                    } else {
                        this.isEditing = true
                        this.editTool = ''
                        this.editToolTitle = '保存编辑'
                    }
                },
                getGreeting() {
                    let time = date.getHours()
                    if (5 <= time && time <= 7) {
                        return '清晨好'
                    } else if (7 < time && time < 11) {
                        return '上午好'
                    } else if (11 <= time && time < 13) {
                        return '中午好'
                    } else if (13 <= time && time < 18) {
                        return '下午好'
                    } else if (18 <= time && time < 20) {
                        return '傍晚好'
                    } else {
                        return '晚上好'
                    }
                },
                submitHealthReport() {
                    this.hasSubmitted = true
                    this.submitBtnText = '已提交 '

                }
            }

        })
    })(window)